// app.js
App({
  onLaunch() {
    // let {
    //   statusBarHeight,
    //   windowHeight,
    //   windowWidth
    // } = wx.getSystemInfoSync();
    wx.getSystemInfo({
      success: (result) => {
        if (result) {
          let {
            statusBarHeight,
            screenHeight,
            screenWidth,
          } = result;

          this.globalData.statusBarHeight = statusBarHeight * 750 / screenWidth;
          this.globalData.screenHeight = screenHeight * 750 / screenWidth;
          this.globalData.screenWidth = 750;
        }
      },
    })
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },
  globalData: {
    statusBarHeight: 0,
    windowHeight: 0,
    windowWidth: 0,
    userInfo: null
  }
})